package com.kelvin.manage.mapper;

import com.kelvin.manage.model.User;
import lombok.Data;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("select * from User where username=#{username}")
    public User getUserByUsername(String username);

    @Select("select * from User where username=#{username} and password=#{password}")
    public User getUserByIdByUserIdAndPassword(String username,String password);

    @Insert("insert into user(username, password, role) VALUES(#{username}, #{password}, #{role})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public int insertUser(User user);
    
    @Delete("delete from user where id=#{id}")
    public int deldeteUser(long id);
}
